﻿using System.Collections.Generic;

namespace Framework.Core.Domain
{
    public interface IFactoryDaoBase<T, IDT>
    {
        /// <summary>
        /// 通过ID得到实体
        /// </summary>
        /// <param name="entityId"></param>
        /// <param name="shouldLock"></param>
        /// <returns></returns>
        SubT GetById<SubT>(IDT entityId, bool shouldLock) where SubT : T;

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<SubT> GetAll<SubT>() where SubT : T;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void Save(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        void Update(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        void SaveOrUpdate(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void Delete(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="conditions"></param>
        /// <param name="startIndex"></param>
        /// <param name="count"></param>
        /// <param name="sortInfo"></param>
        /// <returns></returns>
        IList<SubT> GetByConditions<SubT>(List<string> conditions, int startIndex, int count, SortInfo sortInfo) where SubT : T;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="conditions"></param>
        /// <returns></returns>
        int GetCountByConditions<SubT>(List<string> conditions) where SubT : T;
    }
}
